/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.car.entity;

import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.DataEntity;

import java.util.Map;

/**
 * 会员信息Entity
 * @author xiaoqian
 * @version 2018-01-07
 */
public class GpsMember extends DataEntity<GpsMember> {
	
	private static final long serialVersionUID = 1L;
	private String openid;		// openid
	private String nickname;		// 昵称
	private String sex;		// 性别
	private String province;		// 省
	private String city;		// 市
	private String country;		// 国家
	private String headimgurl;		// 头像
	private String privilege;		// 特权
	
	public GpsMember() {
		super();
	}

	public GpsMember(Map<String,Object> userinfo) {
		super();
		this.openid = userinfo.get("openid")+"";
		this.nickname = userinfo.get("nickname")+"";
		this.sex = userinfo.get("sex")+"";
		this.province = userinfo.get("province")+"";
		this.city = userinfo.get("city")+"";
		this.country = userinfo.get("country")+"";
		this.headimgurl = userinfo.get("headimgurl")+"";
		this.privilege = userinfo.get("privilege")+"";
	}

	public GpsMember(String id){
		super(id);
	}

	@Length(min=0, max=64, message="openid长度必须介于 0 和 64 之间")
	public String getOpenid() {
		return openid;
	}

	public void setOpenid(String openid) {
		this.openid = openid;
	}
	
	@Length(min=0, max=64, message="昵称长度必须介于 0 和 64 之间")
	public String getNickname() {
		return nickname;
	}

	public void setNickname(String nickname) {
		this.nickname = nickname;
	}
	
	@Length(min=0, max=2, message="性别长度必须介于 0 和 2 之间")
	public String getSex() {
		if("1".equals(sex)){
			return "男";
		}else if("2".equals(sex)){
			return "女";
		}else{
			return "未知";
		}
	}

	public void setSex(String sex) {
		this.sex = sex;
	}
	
	@Length(min=0, max=64, message="省长度必须介于 0 和 64 之间")
	public String getProvince() {
		return province;
	}

	public void setProvince(String province) {
		this.province = province;
	}
	
	@Length(min=0, max=64, message="市长度必须介于 0 和 64 之间")
	public String getCity() {
		return city;
	}

	public void setCity(String city) {
		this.city = city;
	}
	
	@Length(min=0, max=64, message="国家长度必须介于 0 和 64 之间")
	public String getCountry() {
		return country;
	}

	public void setCountry(String country) {
		this.country = country;
	}
	
	@Length(min=0, max=100, message="头像长度必须介于 0 和 100 之间")
	public String getHeadimgurl() {
		return headimgurl;
	}

	public void setHeadimgurl(String headimgurl) {
		this.headimgurl = headimgurl;
	}
	
	@Length(min=0, max=100, message="特权长度必须介于 0 和 100 之间")
	public String getPrivilege() {
		return privilege;
	}

	public void setPrivilege(String privilege) {
		this.privilege = privilege;
	}
	
}